import avatar from "./avatar.png";
import icon from "./icon.png";
import "./reset.scss";
import "./img-style.css";
import style from "./img-style.scss";
const tools1 = require.context('./jsons/', true, /\.js$/);
const tools2 = require.context('./../test', true, /\.js$/);

var img1 = new Image();
img1.classList.add('img1');
img1.src = avatar;

var img2 = new Image();
img2.classList.add('img2');
img2.src =icon;

var span = document.createElement('span');
span.classList.add('icon');
span.classList.add('iconfont');
span.classList.add('icon-guangbo');

// import()
img2.onclick = () => {
    console.log('img2 被点击')
    import(
        /* webpackChunkName: "lodash" */
        /* webpackMode: "lazy" */
        'lodash'
        ).then(_ => {
        console.log(_);
        console.log(tools1.keys())
    })
};

const importJsons = (json = 'GetMemo') => import(
    /* webpackInclude: /\.json$/ */
    /* webpackMode: "lazy" */
    /* webpackChunkName: "static-json" */
    `./jsons/${json}.json`
    );

img1.onclick = () => {
    importJsons().then(j => {
            console.log(j)
        console.log(tools2.keys())
    })
}


var root = document.querySelector("#root");
root.append(img1);
root.append(img2);
root.append(span)